package com.ma.imclient;

import com.ma.common.enums.IMTerminalType;
import com.ma.common.model.IMGroupMessage;
import com.ma.common.model.IMPrivateMessage;
import com.ma.common.model.IMSystemMessae;
import com.ma.imclient.sender.ImSender;
import lombok.AllArgsConstructor;
import org.springframework.context.annotation.Configuration;

import java.util.List;
import java.util.Map;

@Configuration
@AllArgsConstructor
public class IMClient {
    private final ImSender imSender;
    /**
     * 判断用户是否在线
     *
     */
    public Boolean isOnline(Long userId){
        return imSender.isOnline(userId);
    }
    /**
     * 判断用户是否在线
     */
    public Boolean isOnline(Long userId, IMTerminalType terminalType){
        return imSender.isOnline(userId,terminalType);
    }
    /**
     * 判断多个用户是否在线
     */
    public List<Long> getOnlineUser(List<Long> userIds){
        return imSender.getOnlineUser(userIds);
    }
    public Map<Long,List<IMTerminalType>> getOnlineTerminal(List<Long> userIds){
        return imSender.getOnlineTerminal(userIds);
    }
    /**
     * 发送系统消息
     */
    public<T> void sendSystemMessage(IMSystemMessae<T> messae){
        imSender.sendSystemMessage(messae);
    }
    /**
     * 发送私聊消息
     */
    public<T> void sendPrivateMessage(IMPrivateMessage<T> messae){
        imSender.sendPrivateMessage(messae);
    }
    /**
     * 发送群聊消息
     */
    public <T> void sendGroupMessage(IMGroupMessage<T> message){
        imSender.sendGroupMessage(message);
    }
}
